Hệ thống quản lý trường học bằng PHP / MySQLi
1 <?php
2 SESSION_START();
3 ?>
4 <html>
5
6 <head>
7 <title>Simple invoice in PHP</title>
8 <style type="text/css">
9 body {
10 font-family: Verdana;
11 }
12
13 div.invoice {
14 border:1px solid #ccc;
15 padding:10px;
16 height:740pt;
17 width:570pt;
18 }
19
20 div.company-address {
21 border:1px solid #ccc;
22 float:left;
23 width:200pt;
24 }
25
26 div.invoice-details {
27 border:1px solid #ccc;
28 float:right;
29 width:200pt;
30 }
31
32 div.customer-address {
33 border:1px solid #ccc;
34 float:right;
35 margin-bottom:50px;
36 margin-top:100px;
37 width:200pt;
38 }
39
40 div.clear-fix {
41 clear:both;
42 float:none;
43 }
44
45 table {
46 width:100%;
47 }
48
49 th {
50 text-align: left;
51 }
52
53 td {
54 }
55
56 .text-left {
57 text-align:left;
58 }
59
60 .text-center {
61 text-align:center;
62 }
63
64 .text-right {
65 text-align:right;
66 }
67
68 </style>
69 </head>
70
71 <body>
72 <div class="invoice">
73 <div class="company-address">
74 ACME ltd
75 <br />
76 489 Road Street
77 <br />
78 London, AF3Z 7BP
79 <br />
80 </div>
81
82 <div class="invoice-details">
83 Invoice N°: 564
84 <br />
85 Date: 24/01/2012
86 </div>
87
88 <div class="customer-address">
89 To:
90 <br />
91 Mr. Bill Terence
92 <br />
93 123 Long Street
94 <br />
95 London, DC3P F3Z
96 <br />
97 </div>
98
99 <div class="clear-fix"></div>
100 <table border='1' cellspacing='0'>
101 <tr>
102 <th width=250>Description</th>
103 <th width=80>Amount</th>
104 <th width=100>Unit price</th>
105 <th width=100>Total price</th>
106 </tr>
107
108 <?php
109 $total = 0;
110 $vat = 21;
111
112 $articles = array(
113 array("Motherboard","Case","RAM","Hard Disk","Monitor", "Installation"),
114 array(1,1,2,2,1,1),
115 array(65,80,70,125,210,30)
116 );
117
118 for($a=0;$a<5;$a++) {
119 $description = $articles[0][$a];
120 $amount = $articles[1][$a];
121 $unit_price = number_format( $articles[2][$a], 2);
122 $total_price = number_format( $amount * $unit_price, 2);
123 $total += $total_price;
124 echo("<tr>");
125 echo("<td>$description</td>");
126 echo("<td class='text-center'>$amount</td>");
127 echo("<td class='text-right'>€$unit_price</td>");
128 echo("<td class='text-right'>€$total_price</td>");
129 echo("</tr>");
130 }
131
132 echo("<tr>");
133 echo("<td colspan='3' class='text-right'>Sub total</td>");
134 echo("<td class='text-right'>€" . number_format($total,2) . "</td>");
135 echo("</tr>");
136 echo("<tr>");
137 echo("<td colspan='3' class='text-right'>VAT</td>");
138 echo("<td class='text-right'>€" . number_format(($total*$vat)/100,2) . "</td>");
139 echo("</tr>");
140 echo("<tr>");
141 echo("<td colspan='3' class='text-right'><b>TOTAL</b></td>");
142 echo("<td class='text-right'><b>€" . number_format(((($total*$vat)/100)+$total),2) . "</b></td>");
143 echo("</tr>");
144 ?>
145 </table>
146 </div>
147 </body>
148
149 </html>